package com.simpletour.qa.gateway.rpc;

import com.simpletour.qa.common.entity.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
* 用户模块内部接口
* @author zhaohw
* @date 2018/6/21 17:15
*/
@FeignClient(serviceId = "qa-user",path = "/rpc/user")// 使用Mockmvc生成doc时 无法通过serviceId找到feign server 所以暂时加上url 
public interface IUserService {

    /**
     * 通过用户名查找用户
     * @param username
     * @return
     */
    @RequestMapping(value = "/username/{username}",method = RequestMethod.GET)
    User findUserByUsername(@PathVariable(name = "username") String username);

    /**
     * 通过用户id查找用户
     * @param id
     * @return
     */
    @RequestMapping(value = "/{id}",method = RequestMethod.GET)
    User findUserByUserId(@PathVariable(name = "id")Integer id);
}
